package jvm;

import java.util.ArrayList;

/**
 * @author TANGYE
 * @date 2021/6/13 12:12 下午
 **/
public class LearnGC {

    private static final int _512KB = 512 * 1024;
    private static final int _1MB = 1024 * 1024;
    private static final int _5MB = 5 * _1MB;
    private static final int _10MB = 10 * _1MB;

    public static void main(String[] args) {
        ArrayList<byte[]> list = new ArrayList<>();
        list.add(new byte[_10MB]);
        list.add(new byte[_5MB]);
        list.add(new byte[_1MB]);
        list.add(new byte[_1MB]);
        list.add(new byte[_1MB]);
        list.add(new byte[_1MB]);
    }
}


//Heap
//        PSYoungGen      total 6144K, used 1862K [0x00000007bf980000, 0x00000007c0000000, 0x00000007c0000000)
//        eden space 5632K, 33% used [0x00000007bf980000,0x00000007bfb51bf8,0x00000007bff00000)
//        from space 512K, 0% used [0x00000007bff80000,0x00000007bff80000,0x00000007c0000000)
//        to   space 512K, 0% used [0x00000007bff00000,0x00000007bff00000,0x00000007bff80000)
//        ParOldGen       total 13824K, used 0K [0x00000007bec00000, 0x00000007bf980000, 0x00000007bf980000)
//        object space 13824K, 0% used [0x00000007bec00000,0x00000007bec00000,0x00000007bf980000)
//        Metaspace       used 3306K, capacity 4496K, committed 4864K, reserved 1056768K
//class space    used 365K, capacity 388K, committed 512K, reserved 1048576K

// real-GC耗费时间
//[GC (Allocation Failure) [PSYoungGen: 1749K->496K(6144K)] 11990K->10760K(19968K), 0.0013199 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
//[GC (Allocation Failure) [PSYoungGen: 496K->512K(6144K)] 10760K->10776K(19968K), 0.0074777 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
//[Full GC (Allocation Failure) [PSYoungGen: 512K->0K(6144K)] [ParOldGen: 10264K->10663K(13824K)] 10776K->10663K(19968K), [Metaspace: 3299K->3299K(1056768K)], 0.0066033 secs] [Times: user=0.01 sys=0.00, real=0.01 secs]
//[GC (Allocation Failure) [PSYoungGen: 0K->0K(6144K)] 10663K->10663K(19968K), 0.0005089 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
//[Full GC (Allocation Failure) [PSYoungGen: 0K->0K(6144K)] [ParOldGen: 10663K->10646K(13824K)] 10663K->10646K(19968K), [Metaspace: 3299K->3299K(1056768K)], 0.0095648 secs] [Times: user=0.01 sys=0.01, real=0.01 secs]
